import { Controller, Post, Get, Body } from '@nestjs/common';
import { AuthService } from './auth.service';
import { ValidationPipe } from '../../pipes/validate.pipe';
import { UserService } from '../user/user.service'
import { LoginDto } from './dto/login.dto'
import { RigisterDto } from './dto/rigister.dto'

@Controller('auth')
export class AuthController {
    constructor(
        private readonly authService: AuthService,
    ) {

    }

    @Post('login')
    login(@Body(new ValidationPipe) loginDto: LoginDto) {
        // console.log('收到了请求')
        return this.authService.login(loginDto)
    }

    @Post('register')
    rigister(@Body(new ValidationPipe()) rigisterDto: RigisterDto) {
        return this.authService.addUser(rigisterDto)
    }
}
